﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ClientApplication
{
    public partial class Admin2 : Form , IAdmin2
    {
        public event AddContestantsEventHandler AddManual = null;
        public event ReadFromFileEventHandler ReadFromFile = null;

        public Admin2()
        {
            InitializeComponent();
            
        }

        private void bManualInput_Click(object sender, EventArgs e)
        {
            if (AddManual != null)
                AddManual(this, e);
        }


        private void groupBox1_Enter(object sender, EventArgs e)
        {

        }

        private void Form2_Load(object sender, EventArgs e)
        {

        }

        private void bReadFromFile_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog1.ShowDialog();
            openFileDialog1.Filter = "C# files|*.xml";
            openFileDialog1.FilterIndex = 1;

            if (result == DialogResult.OK)
            {
                string file = openFileDialog1.FileName;
                ReadFromFileEventArgs rFFEventArgs = new ReadFromFileEventArgs(file);
                if (ReadFromFile != null)
                    ReadFromFile(this, rFFEventArgs);
            }
        }
    }
}
